home *** CD-ROM | disk | FTP | other *** search
/ Mastering Internet Develo…oft ActiveX Technologies / Mastering Internet Development with ActiveX (1996)(Microsoft).iso / labs / lab09 / frmleads.frm (.txt) < prev    next >
Visual Basic Form  |  1996-07-16  |  6KB  |  202 lines

  1. VERSION 4.00
  2. Begin VB.Form frmLeads 
  3.    Caption         =   "Sales Leads"
  4.    ClientHeight    =   5940
  5.    ClientLeft      =   1725
  6.    ClientTop       =   1785
  7.    ClientWidth     =   6690
  8.    Height          =   6630
  9.    Left            =   1665
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5940
  12.    ScaleWidth      =   6690
  13.    Top             =   1155
  14.    Width           =   6810
  15.    Begin SHDocVwCtl.WebBrowser dwnLoad 
  16.       Height          =   735
  17.       Left            =   240
  18.       TabIndex        =   1
  19.       Top             =   3360
  20.       Visible         =   0   'False
  21.       Width           =   1215
  22.       Object.Height          =   49
  23.       Object.Width           =   81
  24.       AutoSize        =   0
  25.       ViewMode        =   1
  26.       AutoSizePercentage=   0
  27.       AutoArrange     =   -1  'True
  28.       NoClientEdge    =   -1  'True
  29.       AlignLeft       =   0   'False
  30.       Location        =   "C:\WINDOWS\SYSTEM\BLANK.HTM"
  31.    End
  32.    Begin ComctlLib.ListView lstLeads 
  33.       Height          =   2295
  34.       Left            =   480
  35.       TabIndex        =   0
  36.       Top             =   360
  37.       Width           =   4695
  38.       _Version        =   65536
  39.       _ExtentX        =   8281
  40.       _ExtentY        =   4048
  41.       _StockProps     =   205
  42.       ForeColor       =   -2147483640
  43.       BackColor       =   -2147483643
  44.       Appearance      =   1
  45.       HideSelection   =   0   'False
  46.       Icons           =   ""
  47.       LabelWrap       =   0   'False
  48.       SmallIcons      =   ""
  49.       View            =   3
  50.       NumItems        =   6
  51.       i1              =   "frmLeads.frx":0000
  52.       i2              =   "frmLeads.frx":00B8
  53.       i3              =   "frmLeads.frx":0174
  54.       i4              =   "frmLeads.frx":0224
  55.       i5              =   "frmLeads.frx":02DC
  56.       i6              =   "frmLeads.frx":0394
  57.    End
  58.    Begin VB.Menu mnuFile 
  59.       Caption         =   "File"
  60.       Begin VB.Menu mnuFileRead 
  61.          Caption         =   "&Read Leads List"
  62.       End
  63.       Begin VB.Menu mnuLine1 
  64.          Caption         =   "-"
  65.       End
  66.       Begin VB.Menu mnuFileSend 
  67.          Caption         =   "&Send E-mail"
  68.       End
  69.       Begin VB.Menu mnuFileWebIE 
  70.          Caption         =   "Open Web Site in &Internet Explorer"
  71.       End
  72.       Begin VB.Menu mnuFileWebVB 
  73.          Caption         =   "Open Web Site in &VB"
  74.       End
  75.       Begin VB.Menu mnuLine2 
  76.          Caption         =   "-"
  77.       End
  78.       Begin VB.Menu mnuExit 
  79.          Caption         =   "E&xit"
  80.       End
  81.    End
  82.    Begin VB.Menu mnuPopup 
  83.       Caption         =   "lstPopup"
  84.       Visible         =   0   'False
  85.       Begin VB.Menu mnuPopEmail 
  86.          Caption         =   "&Send E-mail"
  87.       End
  88.       Begin VB.Menu mnuPopWebIE 
  89.          Caption         =   "Open &Web Site in Internet Explorer"
  90.       End
  91.       Begin VB.Menu mnuPopWebVB 
  92.          Caption         =   "Open Web Site in &VB"
  93.       End
  94.    End
  95. Attribute VB_Name = "frmLeads"
  96. Attribute VB_Creatable = False
  97. Attribute VB_Exposed = False
  98. Private Sub OpenWebInIE()
  99.     Dim strWeb As String
  100.     Dim browser As InternetExplorer
  101.     'read the web site address (subitem 5) from the selected list entry
  102.     strWeb = lstLeads.SelectedItem.SubItems(5)
  103.     'start up IE
  104.     Set browser = CreateObject("InternetExplorer.Application")
  105.     browser.Visible = True
  106.     browser.Navigate strWeb
  107. End Sub
  108. Private Sub OpenWebInVB()
  109.     frmBrowse.txtAddress.Text = lstLeads.SelectedItem.SubItems(5)
  110.     frmBrowse.Show
  111.     frmBrowse.cmdGo_Click
  112. End Sub
  113. Private Sub SendEmail()
  114. End Sub
  115. Private Sub FillList()
  116. 'read info from a file and fill in lstLeads
  117.     Dim fhandle As Integer
  118.     Dim filename As String
  119.     Dim strSalesman As String
  120.     Dim strCustomer As String
  121.     Dim strCompany As String
  122.     Dim strPhone As String
  123.     Dim strEmail As String
  124.     Dim strWeb As String
  125.     Dim itmX As ListItem
  126.     fhandle = FreeFile
  127.     filename = App.Path & "\leads.mlt"
  128.     Open filename For Input As fhandle
  129.     Do While Not EOF(1) ' Loop until end of file.
  130.         'read line of information
  131.         Input #fhandle, strSalesman, strCustomer, strCompany, strPhone, strEmail, strWeb
  132.         'add to listview control
  133.         Set itmX = lstLeads.ListItems.Add()
  134.         itmX.Text = strSalesman
  135.         itmX.SubItems(1) = strCustomer
  136.         itmX.SubItems(2) = strCompany
  137.         itmX.SubItems(3) = strPhone
  138.         itmX.SubItems(4) = strEmail
  139.         itmX.SubItems(5) = strWeb
  140.     Loop
  141.     Close fhandle
  142.     'enable menu items
  143.     EnableMenuItems True
  144. End Sub
  145. Sub ClearList()
  146.     Dim i
  147.     For i = 1 To lstLeads.ListItems.Count
  148.         lstLeads.ListItems.Remove 1
  149.     Next
  150. End Sub
  151. Sub EnableMenuItems(enable As Boolean)
  152.     mnuFileSend.Enabled = enable
  153.     mnuFileWebIE.Enabled = enable
  154.     mnuFileWebVB.Enabled = enable
  155. End Sub
  156. Private Sub Form_Load()
  157.     EnableMenuItems False
  158. End Sub
  159. Private Sub Form_Resize()
  160.     Dim c As ColumnHeader
  161.     Dim hdrWidth As Integer
  162.     'make lstLeads the size of frmLeads
  163.     lstLeads.Move 0, 0, frmLeads.ScaleWidth, frmLeads.ScaleHeight
  164.     'split the columns equally
  165.     hdrWidth = (lstLeads.Width / 8)
  166.     For Each c In lstLeads.ColumnHeaders
  167.         c.Width = hdrWidth
  168.     Next
  169. End Sub
  170. Private Sub lstLeads_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  171.     'show popup menu on right mouse click
  172.     If Button = vbRightButton And lstLeads.ListItems.Count <> 0 Then
  173.         'make sure user clicked on an item
  174.         frmLeads.PopupMenu mnuPopup, vbPopupMenuRightButton
  175.     End If
  176. End Sub
  177. Private Sub mnuExit_Click()
  178.     Unload frmLeads
  179. End Sub
  180. Private Sub mnuFileRead_Click()
  181.     ClearList
  182.     FillList
  183. End Sub
  184. Private Sub mnuFileSend_Click()
  185.     SendEmail
  186. End Sub
  187. Private Sub mnuFileWebIE_Click()
  188.     OpenWebInIE
  189. End Sub
  190. Private Sub mnuFileWebVB_Click()
  191.     OpenWebInVB
  192. End Sub
  193. Private Sub mnuPopEmail_Click()
  194.     SendEmail
  195. End Sub
  196. Private Sub mnuPopWebIE_Click()
  197.     OpenWebInIE
  198. End Sub
  199. Private Sub mnuPopWebVB_Click()
  200.     OpenWebInVB
  201. End Sub
  202.